#include"comm.hpp"

int main()
{
    key_t k=getKey();
    printf("key: 0x%x\n",k);
    int shmid=createShm(k);
    printf("shmid: %d\n",shmid);   
    

    char* start=(char*)attachShm(shmid);
    printf("Attach sucess,address start: %p\n",start);
    
    char* message="Hello server,I am another process!";
    pid_t id=getpid();
    int cnt=1;

    while(true)
    {
        snprintf(start,MAX_SIZE,"%s[pid:%d][%d]",message,id,cnt++);
        sleep(1);
    }

    detachShm(start);
    

    //删除不是client的活


    return 0;
}